package com.xsoft.sms.cmpp20.message.impl;

import com.xsoft.sms.cmpp20.message.ICMPP20Message;
import com.xsoft.sms.cmpp20.message.exception.CMPP20MessaageException;

import java.nio.ByteBuffer;

/**
 * package: {PACKAGE_NAME}
 * User: zhanglm
 * Date: 12-9-21
 * Time: 下午1:17
 * Description:
 */
public class CMPP20MessageConnectRespBody implements ICMPP20Message {
	private byte status;
	private String authenticatorISMG;
	private byte version;

	@Override
	public byte[] toBuffer() {
		return new byte[0];  //To change body of implemented methods use File | Settings | File Templates.
	}

	@Override
	public void fromBuffer(byte[] buffer) throws CMPP20MessaageException {
		ByteBuffer buf = ByteBuffer.wrap(buffer);
		status = buf.get();
		byte[] tmp = new byte[16];
		buf.get(tmp);
		authenticatorISMG = new String(tmp);
		version = buf.get();
	}

	public byte getStatus() {
		return status;
	}

	public void setStatus(byte status) {
		this.status = status;
	}

	public String getAuthenticatorISMG() {
		return authenticatorISMG;
	}

	public void setAuthenticatorISMG(String authenticatorISMG) {
		this.authenticatorISMG = authenticatorISMG;
	}

	public byte getVersion() {
		return version;
	}

	public void setVersion(byte version) {
		this.version = version;
	}

	@Override
	public String toString() {
		return "CMPP20MessageConnectResp{" +
				"status=" + status +
				", authenticatorISMG='" + authenticatorISMG + '\'' +
				", version=" + version +
				'}';
	}
}
